const { ccclass, property } = cc._decorator;

@ccclass
export default class CenterLayout extends cc.Component {
    @property(cc.Label)
    nameLabel = null;

    @property(cc.Node)
    cityIcon = null;

    @property([cc.SpriteFrame])
    citySpArr = [];

    index = 0;
    cityName = "";

    initData(e) {
        if (e) {
            const { index, name } = e;
            this.index = index;
            this.cityName = name;
            this.nameLabel.string = name;
            this.cityIcon.getComponent(cc.Sprite).spriteFrame = this.citySpArr[index];
        }
    }

    clickShowCity() {
        console.log("点击展示城市的index====", this.index, this.cityName);
        // 触发事件
    }
}
